﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CSWriter {
	public partial class ImageOptionsForm : Form {

		ImageOptions options;
		public ImageOptions ImageOptions {
			get {
				return options;
			}
			set {
				options = value;
				if (value != null) {
					width.Text = value.MaxWidth.ToString();
					height.Text = value.MaxHeight.ToString();
					resample.Checked = value.Resample;
				}
			}
		}
		public ImageOptionsForm() {
			InitializeComponent();
		}

		private void mnOK_Click(object sender, EventArgs e) {
			DialogResult = DialogResult.OK;
			UpdateOptions();
			Close();
		}

		private void UpdateOptions() {
			options = new ImageOptions();
			options.MaxHeight = int.Parse(height.Text);
			options.MaxWidth = int.Parse(width.Text);
			options.Resample = resample.Checked;
		}

		private void menuItem1_Click(object sender, EventArgs e) {
			DialogResult = DialogResult.Cancel;
			Close();
		}
	}
}